Repository navigation
fix(agents): follow an organization Namespace's Flux labels when the caller cannot read it - #504
Merged
Merged
Conversation
…caller cannot read it In mode commit, when the caller's read of an organization's Namespace is forbidden, create_agent follows the Flux Kustomization labels that agent-manager's ServiceAccount reads on the Namespace, instead of falling back to the organization's content path. The Kustomization and its source are still read as the caller. A read that fails for another reason is an error in an organization namespace. Part of #498
Published Helm chart
|
| Chart | agent-manager |
| Version | 3.5.12-r0a67631ct20261130114608hded983b |
| OCI reference | oci://gsoci.azurecr.io/charts/giantswarm/agent-manager:3.5.12-r0a67631ct20261130114608hded983b |
| Digest | sha256:c5b74c50ff321bc0fef32a5e517bb37c77398d646d310b7ec2d63a1734d00780 |
| Registry | public — gsoci.azurecr.io |
| Git catalog | giantswarm-test-catalog (index) |
Pull this chart
helm pull oci://gsoci.azurecr.io/charts/giantswarm/agent-manager --version 3.5.12-r0a67631ct20261130114608hded983bPosted by architect-orb · build 13588 · commit ded983b · updated in place on every push
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #498
Problem
Item 3 (R1-2) of #498. In mode commit,
create_agentlooks for the target of a new agent in this order: the agent chart source, the agent releases applied from git, the Namespace, and then, in an organization namespace, the organization's content path. The Namespace is cluster-scoped, and an organization's members may notgetit.namespaceLocationdropped a failed read of the Namespace. So when the organization Namespace carries Flux labels to another repository or directory, and no chart source or agent release of the namespace comes from git, a member's commit went to the content path, not to the target that the Namespace's labels name.Change
create_agentfollows the Flux Kustomization labels that agent-manager's ServiceAccount reads on the Namespace. This is the read thatorganizations.Service.ContentLocationalready does (Namespaces.Get). The read gives only the two Flux labels (kustomize.toolkit.fluxcd.io/nameand/namespace).ownerLocation, as for a Namespace that the caller can read. The Kustomization and its source are read as the caller. When the labels name the organization's own Kustomization and the caller may not read it, the target is the content path (the fallback of fix(agents): commit an organization member's agent writes to the content path when the Kustomization cannot be read #500). When the labels name another Kustomization that the caller may not read, the answer isforbidden: get Kustomization <namespace>/<name>, not the content path.agents.Config.OrganizationContentreturnsagents.OrganizationNamespace(the content path and the Namespace's Flux labels) in place ofprovenance.Location. This changes 3 lines incmd/serve.goand the field ininternal/agents/service.go.git merge-treewith the branch of feat: tool approval for agents: settings and grants on an agent's tools, migrate hop to agent chart 3.0 #483 (tool-approval) shows no conflict.docs/organizations-commit-mode.mdhas one new item on this.Tests
TestCommitFollowsTheFluxLabelsOfAnOrganizationNamespaceTheCallerCannotRead(internal/api) uses the real organizations and agent tools. agent-manager's ServiceAccount reads the Namespace from its own fake client, and the caller may not get the Namespace. The test checks five states: no labels (content path), labels to a Kustomization that the caller can read (its repository and directory), a Kustomization that the caller cannot read (error that names it), the organization's own Kustomization (content path), and a 500 on the Namespace read (error). On main the second and third states go to the content path, so the test fails.go test ./...passes.Review
An independent review (deep mode) and a Codex review (one round,
verdict=approve) found no findings.